Skip to content

feat: add fs/stat#11069

Open
ImStillBlessed wants to merge 4 commits intostdlib-js:developfrom
ImStillBlessed:feat/fs-stat
Open

feat: add fs/stat#11069
ImStillBlessed wants to merge 4 commits intostdlib-js:developfrom
ImStillBlessed:feat/fs-stat

Conversation

@ImStillBlessed
Copy link
Contributor

Resolves #2233.

Description

What is the purpose of this pull request?

This pull request:

  • Adds fs/stat package to @stdlib/fs, providing an asynchronous and synchronous API for retrieving file and directory statistics, consistent with the existing filesystem namespace conventions in stdlib.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

I used AI assistance to understand stdlib's filesystem namespace conventions and codebase structure. Documentation was also drafted with AI support. All implementation decisions and final edits were made manually.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review. labels Mar 21, 2026
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not modify this file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not modify this file.

* stat( __dirname, onStat );
*
* function onStat( error, stats ) {
* if ( error ) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shouldn't be mixing tabs and spaces within JSDoc comments.

@@ -0,0 +1,67 @@
{
"name": "@stdlib/fs/stat",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation in this file is incorrect.

Comment on lines +232 to +238

* * *

## See Also

- <span class="package-name">[`@stdlib/fs/read-file`][@stdlib/fs/read-file]</span><span class="delimiter">: </span><span class="description">read the entire contents of a file.</span>
- <span class="package-name">[`node-fs-stats`][node-fs-stats]</span><span class="delimiter">: </span><span class="description">Official Node.js fs.Stats class.</span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* * *
## See Also
- <span class="package-name">[`@stdlib/fs/read-file`][@stdlib/fs/read-file]</span><span class="delimiter">: </span><span class="description">read the entire contents of a file.</span>
- <span class="package-name">[`node-fs-stats`][node-fs-stats]</span><span class="delimiter">: </span><span class="description">Official Node.js fs.Stats class.</span>

You should not include content in this section.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not edit this file.

@kgryte kgryte added Needs Changes Pull request which needs changes before being merged. and removed Needs Review A pull request which needs code review. labels Mar 21, 2026
@github-actions github-actions bot mentioned this pull request Mar 21, 2026
@stdlib-bot stdlib-bot removed the First-time Contributor A pull request from a contributor who has never previously committed to the project repository. label Mar 22, 2026
corrections:

Removed changes from @stdlib/fs/README.md, @stdlib/fs/docs/types/index.d.ts, @stdlib/fs/stat/lib/index.js files
proper indentation on the @stdlib/fs/stat/package.json file
consistent indentation using 2 spaces on the @stdlib/fs/stat/docs/types/index.d.ts file
removed see also section from the @stdlib/fs/stat/README.md file
remove check for runtime support of  arg and let let the runtime handle the error.
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Mar 23, 2026

Coverage Report

Package Statements Branches Functions Lines
fs/stat $\color{red}260/263$
$\color{green}+98.86%$
$\color{red}20/22$
$\color{green}+90.91%$
$\color{green}2/2$
$\color{green}+100.00%$
$\color{red}260/263$
$\color{green}+98.86%$

The above coverage report was generated for the changes in this PR.

fixed License year from 2018 to 2026
@ImStillBlessed
Copy link
Contributor Author

😿 i am having issues with the examples file and the examples and usage sections in the readme's
i mostly tried to follow the pattern and style of the already merged packages in the fs lib.

Hi, @kgryte please let me refactor to try and fix these issues, i was thinking it was because i did not set up my workspace correctly, or blaming windows

OR, if you can see anything in my code that may be problematic, maybe you can help me point it out please
i am so sorry for the inconvenience

fix: remove sync method overload and make options parameter optional

---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
  - task: lint_filenames
    status: passed
  - task: lint_editorconfig
    status: passed
  - task: lint_markdown
    status: na
  - task: lint_package_json
    status: na
  - task: lint_repl_help
    status: na
  - task: lint_javascript_src
    status: na
  - task: lint_javascript_cli
    status: na
  - task: lint_javascript_examples
    status: na
  - task: lint_javascript_tests
    status: na
  - task: lint_javascript_benchmarks
    status: na
  - task: lint_python
    status: na
  - task: lint_r
    status: na
  - task: lint_c_src
    status: na
  - task: lint_c_examples
    status: na
  - task: lint_c_benchmarks
    status: na
  - task: lint_c_tests_fixtures
    status: na
  - task: lint_shell
    status: na
  - task: lint_typescript_declarations
    status: passed
  - task: lint_typescript_tests
    status: passed
  - task: lint_license_headers
    status: passed
---
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Changes Pull request which needs changes before being merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC]: add fs/stat

3 participants